import request from "../utils/request"
import {requestGet,requestPost} from "../api/request/request"
import type getQuestionBanksPage from "@/dto/QuestionDto"
import type {bindAddQuestionDto} from "@/dto/question/QuestionAddDto"
import type {Question_IndexDto} from "@/dto/question/IndexDto"


/**
 * 
 * @param obj 题库详情
 * @returns 
 */
export const getQuestionDetail=(obj:any)=>{
    return requestGet("api/Exam/GetSingleQuestionBank",obj);
}

/**
 * 添加题目到题库(导入题目的题库)
 */
export const importQuestions=(obj:any)=>{
    return requestPost("api/Exam/MoveQuestionsToBank",obj);
}

/**
 * 默认题库试题详情根据题目Id查询题目选项
 */
export const getQuestionOptions=(obj:any)=>{
    return requestGet("api/exam/getQuestionOptions",obj);
}

/**
 * 移除题库试题列表的题目(非默认题库)
 */
export const removeQuestion=(obj:any)=>{
    return requestPost("api/Exam/RemoveQuestionFromBank",obj);
}

/**
 *  查询默认题库试题的试题列表的题目详情
 * @param obj 
 * @returns 
 */
export const getQuestionDetails=(obj:any)=>{
    return requestGet("api/Exam/getSingleQuestion",obj);
    // return requestGet("api/exam/getQuestionDetails",obj);
}

/**
 *  获取当前页面满足勾选的复选框的默认题库试题的试题列表
 * @param obj 
 * @returns 
 */
export const queryAllQuestionChecks=(obj:any)=>{
    return requestGet("api/Exam/GetQuestions",obj);
    // return requestGet("api/exam/queryAllQuestionChecks",obj);
}


/**
 *  默认题库的题目恢复与禁用
 * @param obj
 * @returns 
 */
export const TopicIsBan=(obj:any)=>{
    return requestPost("api/Exam/banQuestions",obj);
    // return requestPost("api/exam/TopicIsBan",obj);
}
/**
 * 默认题库删除题目
 */
export const delQUestion =(obj:any)=>{
    return requestPost("api/Exam/deleteQuestions",obj);
    // return requestPost("api/exam/delQUestion",obj);
}
/**
 * 默认题库发布题目
 */
export const TopicIsPublish=(obj:any)=>{
    return requestPost("api/Exam/PublishQuestions",obj)
    // return requestPost("api/exam/TopicIsPublish",obj);
}

/**
 *  查询默认题库试题的试题列表
 *  参数类型,暂停使用 Question_IndexDto，使用any替代
 */
export const queryAllQuestion=(obj:any)=>{
    return requestGet("api/Exam/GetQuestions",obj);
    // return requestGet("api/exam/queryAllQuestion",obj);
}
/**
 * 添加默认题库的题目
 */
export const addTopic=(obj:any)=>{
    return requestPost("api/Exam/AddQuestions",obj);
//    return requestPost("api/exam/addTopic",obj);
}
/**
 * 获取当前页面的题库数据 题库管理页面
 */
export const getQuestionBanks=(obj:getQuestionBanksPage)=>{
    return requestGet("api/Exam/GetQuestionBanks",obj);
        return request({
            url:"api/exam/getQuestionBanks",
            params:obj,
            method:"get"
        })
}

/**
 * 获取默认题库的数量
 */
export const getQuestionBankCount=(obj:any)=>{
     return  requestGet("api/Exam/GetQuestionsCount","");
    // return request({
    //     url:"api/exam/getQuestionBankCount",
    //     params:obj,
    //     method:"get"
    // })

}

/**
 * 根据题库ID删除题库
 * @param obj 
 */
export const delQuestionBank=(obj:any)=>{
    return  requestPost("api/Exam/DeleteQuestionBanks",obj);
    // return request({
    //     url:"api/exam/delQuestionBank",
    //     data:obj,
    //     method:"post"
    // })
}

/**
 * 
 * @param obj 修改是否禁用状态  0为当前启用状态 1为当前禁用状态
 * @returns 
 */
export const editIsBan=(obj:any)=>{
    
    return requestPost("api/Exam/banQuestionBanks",obj)
    // return request({
    //     url:"api/exam/editIsBan",
    //     data:obj,
    //     method:"post"
    // })
}

/**
 * 发布题库/取消题库
 * @param obj 
 */
export const editPublish=(obj:any)=>{
    return requestPost("api/Exam/PublishQuestionBanks",obj)
    // return request({
    //     url:"api/exam/editPublish",
    //     data:obj,
    //     method:"post"
    // })
}

/**
 * 添加题库
 * @param obj 
 * @returns 
 */
export const addQuestion=(obj:any)=>{
    return requestPost("api/Exam/AddQuestionBank",obj);
    // return request({
    //     url:"api/exam/addQuestion",
    //     data:obj,
    //     method:"post"
    // })
}